﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class AlbumList : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        Sharemp3DataContext db = new Sharemp3DataContext();

        var albumlist = (from i in db.Albums
                           select new
                           {
                               AlbumID = i.AlbumID,
                               AlbumName = i.AlbumName,
                               ArtistName = i.Artist.ArtistName,
                               Date = i.Date,
                               Rating = i.Rating,
                               AlbumCover = i.AlbumCover
                           }).OrderByDescending(i => i.Rating).OrderByDescending(i => i.Date).Take(20);

        Rpt_AlbumList.DataSource = albumlist;
        Rpt_AlbumList.DataBind();
    }
}